package com.vasthu.gui.utility;


public class VstGuiUtils {

    public static int getMaxDateForYearAndMonth(String sYear, String sMonth) {
        java.util.Calendar cal = java.util.Calendar.getInstance();

        int year = Integer.parseInt(sYear);
        int month = getMonthValue(sMonth);

        cal.set(year, month, 1);
        return cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
    }

    public static int getMonthValue(String sMonth) {
        int month = -1;
        if (sMonth.equals("January")) {
            month = 0;
        } else if (sMonth.equals("February")) {
            month = 1;
        } else if (sMonth.equals("March")) {
            month = 2;
        } else if (sMonth.equals("April")) {
            month = 3;
        } else if (sMonth.equals("May")) {
            month = 4;
        } else if (sMonth.equals("June")) {
            month = 5;
        } else if (sMonth.equals("July")) {
            month = 6;
        } else if (sMonth.equals("August")) {
            month = 7;
        } else if (sMonth.equals("September")) {
            month = 8;
        } else if (sMonth.equals("October")) {
            month = 9;
        } else if (sMonth.equals("November")) {
            month = 10;
        } else if (sMonth.equals("December")) {
            month = 11;
        } else {
            month = -1;
        }
        return month;
    }
}